package dto;


/**
 * @author Jonathan Maret
 * Class used to manage classes
 * 2 classe are equals if each field but there id is the same
 * ToString return th name of the class
 */
public class DTOClass  {
	@Override
	public String toString() {
		return name;
	}
	private int id;
	private String name;
	private int	holder_id;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getHolder_id() {
		return holder_id;
	}
	public void setHolder_id(int holder_id) {
		this.holder_id = holder_id;
	}
	/**
	 * Each field is required to create a class
	 * @param id
	 * @param name
	 * @param holder_id
	 */
	public DTOClass(int id, String name, int holder_id) {
		super();
		this.id = id;
		this.name = name;
		this.holder_id = holder_id;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + holder_id;
		result = prime * result + id;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DTOClass other = (DTOClass) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	

}
